home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 301-325 / disk_315 / surf / menu_color.c < prev    next >
C/C++ Source or Header  |  1992-05-06  |  3KB  |  104 lines

  1. /*
  2.  * Menu description for selecting color mapping
  3.  */
  4. static struct IntuiText colortext[] = {
  5.    { 0, 1, JAM2, 20, 0, NULL, (UBYTE *)"grey",  NULL },
  6.    { 0, 1, JAM2, 20, 0, NULL, (UBYTE *)"red",   NULL },
  7.    { 0, 1, JAM2, 20, 0, NULL, (UBYTE *)"green", NULL },
  8.    { 0, 1, JAM2, 20, 0, NULL, (UBYTE *)"blue",  NULL },
  9.    { 0, 1, JAM2, 20, 0, NULL, (UBYTE *)"rainbow",NULL }
  10. };
  11.  
  12. #define ColNum (sizeof(colortext)/sizeof(struct IntuiText))
  13. #define ColXMask ((1<<ColNum)-1)
  14. #define ColorExclude(entry) (ColXMask^( 1<<entry))
  15.  
  16. #define COLMEMFLAGS  ( CHECKIT | ITEMTEXT | HIGHCOMP | ITEMENABLED )
  17.  
  18. struct MenuItem coloritems[] = {
  19.   { &coloritems[1], /* next item */
  20.     10, 0, 80 , 10, /* x,y,w,h */
  21.     COLMEMFLAGS| CHECKED,
  22.     ColorExclude(0), /* mutual exclude bits */
  23.     (APTR) &colortext[0],  /* grey */
  24.     NULL, /* highlight image */
  25.     'h', /* command byte ? */
  26.     NULL, /* submenu item */
  27.     0 /* next select for select dragging */
  28.     },
  29.   { &coloritems[2], /* next item */
  30.     10, 10, 80 , 10, /* x,y,w,h */
  31.     COLMEMFLAGS,
  32.     ColorExclude(1), /* mutual exclude bits */
  33.     (APTR) &colortext[1],     /* red */
  34.     NULL, /* highlight image */
  35.     'h', /* command byte ? */
  36.     NULL, /* submenu item */
  37.     0 /* next select for select dragging */
  38.     },
  39.   { &coloritems[3], /* next item */
  40.     10, 20, 80 , 10, /* x,y,w,h */
  41.     COLMEMFLAGS,
  42.     ColorExclude(2), /* mutual exclude bits */
  43.     (APTR) &colortext[2],
  44.     NULL, /* highlight image */
  45.     'h', /* command byte ? */
  46.     NULL, /* submenu item */
  47.     0 /* next select for select dragging */
  48.     },
  49.   { &coloritems[4], /* next item */
  50.     10, 30, 80 , 10, /* x,y,w,h */
  51.     COLMEMFLAGS,
  52.     ColorExclude(3), /* mutual exclude bits */
  53.     (APTR) &colortext[3],
  54.     NULL, /* highlight image */
  55.     'h', /* command byte ? */
  56.     NULL, /* submenu item */
  57.     0 /* next select for select dragging */
  58.     },
  59.   { NULL, /* next item */
  60.     10, 40, 80 , 10, /* x,y,w,h */
  61.     COLMEMFLAGS,
  62.     ColorExclude(4), /* mutual exclude bits */
  63.     (APTR) &colortext[4],
  64.     NULL, /* highlight image */
  65.     'h', /* command byte ? */
  66.     NULL, /* submenu item */
  67.     0 /* next select for select dragging */
  68.     }
  69. };
  70.  
  71.  
  72.  
  73. void MenuSetColMap()
  74. {
  75.     int which;
  76.  
  77.     for( which = 0; which < ColNum; which++ ) {
  78.         if( Selected(coloritems[which]))
  79.             break;
  80.     }
  81.  
  82.     SetHourGlassCol();
  83.  
  84.     switch( which ) {
  85.     case 0:
  86.         SetMono( 0xf, 0xf, 0xf );
  87.         break;
  88.     case 1:
  89.         SetMono( 0xf, 0, 0 );
  90.         break;
  91.     case 2:
  92.         SetMono( 0, 0xf, 0 );
  93.         break;
  94.     case 3:
  95.         SetMono( 0x0, 0x0, 0xf );
  96.         break;
  97.     case 4:
  98.         SetRainbow();
  99.         break;
  100.     default:
  101.         break;
  102.     }
  103. }
  104.